package Test.ThirdTwo;

/**
 * 实现Print接口的测试类2
 */
public class PrintTestTwo implements Print{

    private int length;
    private int width;
    /**
     * 无参数构造器
     * 默认：长5 宽4
     */
    public PrintTestTwo(){
        length=5;
        width=4;
    }
    /**
     *
     * @param l 长
     * @param w 宽
     */
    public PrintTestTwo(int l,int w){
        this.length=l;
        this.width=w;
    }

    /**
     * 实现接口print()方法用于输出长方形的属性
     */
    @Override
    public void print(){
        System.out.println("长方形的长为："+length+" 宽为："+width);
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }


    public static void main(String[] args) {
        PrintTestOne testOne=new PrintTestOne();
        PrintTestTwo testTwo=new PrintTestTwo();

        testOne.print();
        testTwo.print();
    }
}
